package cn.iocoder.yudao.module.nmkj.dal.mysql.serviceintroduce;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.nmkj.dal.dataobject.serviceintroduce.ServiceIntroduceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.nmkj.controller.admin.serviceintroduce.vo.*;

/**
 * 服务介绍 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ServiceIntroduceMapper extends BaseMapperX<ServiceIntroduceDO> {

    default PageResult<ServiceIntroduceDO> selectPage(ServiceIntroducePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ServiceIntroduceDO>()
                .eqIfPresent(ServiceIntroduceDO::getImg, reqVO.getImg())
                .eqIfPresent(ServiceIntroduceDO::getTitleService, reqVO.getTitleService())
                .eqIfPresent(ServiceIntroduceDO::getTitleSub, reqVO.getTitleSub())
                .eqIfPresent(ServiceIntroduceDO::getDescribes, reqVO.getDescribes())
                .eqIfPresent(ServiceIntroduceDO::getContent, reqVO.getContent())
                .eqIfPresent(ServiceIntroduceDO::getSort, reqVO.getSort())
                .eqIfPresent(ServiceIntroduceDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ServiceIntroduceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ServiceIntroduceDO::getStatus)
                .orderByDesc(ServiceIntroduceDO::getSort));
    }

    default List<ServiceIntroduceDO> selectList(ServiceIntroducePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ServiceIntroduceDO>()
                .eqIfPresent(ServiceIntroduceDO::getImg, reqVO.getImg())
                .eqIfPresent(ServiceIntroduceDO::getTitleService, reqVO.getTitleService())
                .eqIfPresent(ServiceIntroduceDO::getTitleSub, reqVO.getTitleSub())
                .eqIfPresent(ServiceIntroduceDO::getDescribes, reqVO.getDescribes())
                .eqIfPresent(ServiceIntroduceDO::getContent, reqVO.getContent())
                .eqIfPresent(ServiceIntroduceDO::getSort, reqVO.getSort())
                .eqIfPresent(ServiceIntroduceDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ServiceIntroduceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ServiceIntroduceDO::getStatus)
                .orderByDesc(ServiceIntroduceDO::getSort));
    }

}